package pack02_wordcount_partitioner;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

/**
 * @author lilulu
 * @date 2023/2/11 0:46
 */
public class WordCountPartitioner2 extends Partitioner<Text, LongWritable> {
    @Override
    public int getPartition(Text text, LongWritable longWritable, int i) {
        String k2 = text.toString();
        if (k2.length() < 5) {
            return 0;
        }else if (k2.length() == 5) {
            return 1;
        }else{
            return 2;
        }
    }
}
